<!--
 * @Author: luoqi
 * @Date: 2022-04-17 20:46:25
 * @LastEditors: luoqi
 * @LastEditTime: 2022-05-04 10:29:16
 * @Description: 
-->
<template>
  <!-- 收藏疾病知识 -->
   <el-row class="Ctogether">
      <el-col :span="24">
        <p>收藏疾病知识</p>
        <el-row>
          <el-col :span="24">
            <router-link :to="{path:'/main/knowledgedetail',query:{id:item.targetId}}" class="video" v-for="(item, index) in knowledgeList" :key="index "  >
            
              <div class="video_img">
                <img :src="item.imgUrl" alt="" />
              </div>
              <router-link to="">
                <div class="video_header">
                  {{item.title}}
                </div></router-link
              >
              <div class="video_label">
                 <el-tag
                        type="success"
                        class="label"
                        v-for="(el, indexs) in item.tag.split(',')"
                        :key="indexs + '2'"
                        >{{ el }}</el-tag
                      >
              </div>
            </router-link>          </el-col>
        </el-row>
      </el-col>
    </el-row>
</template>

<script>
export default {
  props:['collection'],
   data(){
    return {
      knowledgeList:[]
    }
  },
    watch: {
    collection(old,newData) {
      if (newData) {
         if(this.$route.path=="/main/MyHome/myknowledeg"){
      this.knowledgeList=this.$store.state.mySelect.knowledgeList
    }else{
      this.knowledgeList=this.$store.state.herData.collection.knowledgeList
    }
      }
    },
  },
  created() {
    if(this.$route.path=="/main/MyHome/myknowledeg"){
      this.knowledgeList=this.$store.state.mySelect.knowledgeList
    }else{
      this.knowledgeList=this.$store.state.herData.collection.knowledgeList
    }
  }
}
</script>

<style lang="less" scoped>
@import url("../../less/myhome.less");
</style>